package cn.wolfcode.util;

import cn.wolfcode.common.domain.UserInfo;
import cn.wolfcode.redis.CommonRedisKey;
import com.alibaba.fastjson.JSON;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * Created by lanxw
 */
public class UserUtil {
    public static UserInfo getUser(StringRedisTemplate redisTemplate, String token) {
        String jsonString = redisTemplate.opsForValue().get(CommonRedisKey.USER_TOKEN.getRealKey(token));
        return JSON.parseObject(jsonString, UserInfo.class);
    }
}
